cmake_minimum_required( VERSION 2.8 )
project("rezervilo")
find_package( Qt4 REQUIRED )
include( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES(
    ${QT_INCLUDE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    ../qxmlrpc
    ../server
)


set( HEADERS
    mwin.h
    logondialog.h
    diausers.h
    diaevents.h
    diatariffs.h
    diawait.h
)

set( CPPS
        main.cpp
        mwin.cpp
        logondialog.cpp
        diausers.cpp
        diaevents.cpp
        diatariffs.cpp
        diawait.cpp
)
set( UIS
        mwin.ui
        logondialog.ui
        diausers.ui
        diaevents.ui
        diatariffs.ui
        diawait.ui
)

qt4_wrap_ui(UIS_H ${UIS})

qt4_wrap_cpp( MOC_SOURCES ${HEADERS} )

set( RESOURCES res.qrc )
qt4_add_resources( QRC_SOURCES ${RESOURCES} )

add_executable( rezervilo WIN32 ${CPPS} ${MOC_SOURCES} ${UIS_H} ${QRC_SOURCES})

target_link_libraries( rezervilo ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES} qxmlrpc)

# install for linux
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
    set(rootdir ${CMAKE_INSTALL_PREFIX})
    set(rootdir_bin ${rootdir}/bin)
    install(TARGETS rezervilo DESTINATION ${rootdir_bin})
endif()
# install for mac os x
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
    set(rootdir ${CMAKE_INSTALL_PREFIX})
    set(rootdir_bin ${rootdir}/bin)
    install(TARGETS rezervilo DESTINATION ${rootdir_bin})
endif()
